package server.business.entity;

public class Token implements java.io.Serializable{
	
	private static final long serialVersionUID = 9988881L;

	public String id;
	
	private long expirationTime = -1;

	public Token(){
	    
	}
	
	public Token(String id){
		
		this.id = id;
		
		this.expirationTime = -1;
	}
	
	public Token(String id,long expirationTime){
		
		this.id = id;
		
		if (expirationTime < -1){
			
			this.expirationTime = -1;
		
		} else {
			
			this.expirationTime = expirationTime;
		}
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public long getExpirationTime() {
		return expirationTime;
	}

	public void setExpirationTime(long expirationTime) {
		this.expirationTime = expirationTime;
	}

	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return super.hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		
		Token token = (Token)obj;
		
		if (token.getId().equals(this.id) && token.getExpirationTime() == this.expirationTime){
			
			return true;
		}
		
		return false;
	}
	
	
}
